/*
 * Copyright (c) 2014 Andy Huang <andyspider@126.com>
 *
 * This file is part of Camkit.
 *
 * Camkit is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Camkit is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Camkit; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef DECODE_H
#define DECODE_H
#include "comdef.h"

enum
{
    CV_FFMPEG_CAP_PROP_POS_MSEC=0,
    CV_FFMPEG_CAP_PROP_POS_FRAMES=1,
    CV_FFMPEG_CAP_PROP_POS_AVI_RATIO=2,
    CV_FFMPEG_CAP_PROP_FRAME_WIDTH=3,
    CV_FFMPEG_CAP_PROP_FRAME_HEIGHT=4,
    CV_FFMPEG_CAP_PROP_FPS=5,
    CV_FFMPEG_CAP_PROP_FOURCC=6,
    CV_FFMPEG_CAP_PROP_FRAME_COUNT=7
};

/**
 * decode parameters
 */
struct dec_param
{
	char*  filename;
};

/**< decode handle */
struct dec_handle;

/**
 * @brief Open a decode instance
 * @param param the decode parameters
 * @return the decode handle
 */
struct dec_handle *decode_open(struct dec_param param);

/**
 * @brief Close a decode intance
 * @param handle the decode handle
 */
void decode_close(struct dec_handle *handle);

/**
 * @brief Decode a frame
 * @param handle the decode handle
 * @param pbuf pointer to the buffer to save the frame
 * @param plen the buffer len pointer
 * @return -1 on error, 0 on ok
 * @see encode_loop()
 */
int decode_do(struct dec_handle *handle, void **pobuf, int *polen);




#endif /* DECODE_H */
